package cn.wolfcode.luowowo.serach.template;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Document(indexName="luowowo_flight",type="flight")
@Getter
@Setter
public class FlightTemplate implements Serializable {


    public static final String INDEX_NAME = "luowowo_flight";
    public static final String TYPE_NAME = "flight";
    @Id
    //@Field 每个文档的字段配置（类型、是否分词、是否存储、分词器 ）
    @Field(store=true, index = false,type = FieldType.Long)
    private Long id;  //id

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String airlineName; //航空公司名
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String flightNum; 	//航班号

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String fromCityName; //出发城市名称
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String toCityName; 	//到达城市名称

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String fromCityCode; //出发城市三字码
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String toCityCode; 	//到达城市三字码

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String takeoffPortName; //起飞机场名称
    @Field(index=true,store=true,type = FieldType.Keyword)
    private String landingPortName; //降落机场名称

    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type = FieldType.Date, format = DateFormat.custom)
    private Date takeoffTime;	//起飞时间
    @Field(pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis", type = FieldType.Date, format = DateFormat.custom)
    private Date landingTime;	//降落时间

    private String planeType; 	//机型
    private String planeTypeDesc; 	//机型说明

    @Field(index=true,store=true,type = FieldType.Keyword)
    private String timeDifference; 	//时间差

    private Integer adultAirportPrice; 	//成人机建税
    private Integer childAirportPrice; 	//儿童机建税

    private String basePrice; 	//最低价

    private double punctualityRate; 	//准点率

    private List<CabinInfoTemplate> cabinInfos = new ArrayList<>();//舱位信息

}